package study.dubbo.springboot.consumer.controller;

import cn.hutool.core.map.MapUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import study.eggs.result.Result;
import study.eggs.result.Results;
import study.rpc.dubbo.api.EchoService;

@Slf4j
@RestController
public class EchoController {

    @DubboReference
    private EchoService echoService;

    @RequestMapping("/echo")
    public Result echo() {
        log.info(">>>>>> echo echo echo");
        String msg = echoService.echo("wangzhj");
        return Results.ok(MapUtil.of("", msg));
    }
}
